import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'

@Component({
  selector: 'app-model-assessment',
  templateUrl: './model-assessment.component.html',
  styleUrls: ['./model-assessment.component.scss']
})
export class ModelAssessmentComponent implements OnInit {

  step: number = 1;
  isDetail:boolean = true;
  listOfData: any = [];
  isVisible:boolean = false;

  barChart = {
    legend: {},
    tooltip: {},
    dataset: {
        source: [
            ['product', '2015', '2016', '2017'],
            ['Matcha Latte', 43.3, 85.8, 93.7],
            ['Milk Tea', 83.1, 73.4, 55.1],
            ['Cheese Cocoa', 86.4, 65.2, 82.5],
            ['Walnut Brownie', 72.4, 53.9, 39.1]
        ]
    },
    xAxis: {type: 'category'},
    yAxis: { name: "评估参数对比" },
    series: [
        {type: 'bar'},
        {type: 'bar'},
        {type: 'bar'}
    ]
  };

  nodes = [
    {
      title: 'parent 1',
      key: '100',
      expanded: true,
      children: [
        {
          title: 'parent 1-0',
          key: '1001',
          expanded: true,
          children: [
            { title: 'leaf', key: '10010', isLeaf: true },
            { title: 'leaf', key: '10011', isLeaf: true },
            { title: 'leaf', key: '10012', isLeaf: true }
          ]
        },
        {
          title: 'parent 1-1',
          key: '1002',
          children: [{ title: 'leaf', key: '10020', isLeaf: true }]
        },
        {
          title: 'parent 1-2',
          key: '1003',
          children: [
            { title: 'leaf', key: '10030', isLeaf: true },
            { title: 'leaf', key: '10031', isLeaf: true }
          ]
        }
      ]
    }
  ];

  constructor(private router:Router) { }

  ngOnInit() {
    setTimeout(() => {
      this.step = 2;
    }, 1000);

    this.listOfData = new Array(100).fill(0).map((_, index) => {
      return {
        id: index,
        url: `../../../../../assets/images/bgd.jpeg`
      };
    });
  }

  swIsDetail(){
    this.isDetail = !this.isDetail;
  }

  handleCancel(){    
    this.isVisible = false;
  }

  onImgClick(id:any){
    this.isVisible = true;
  }

  return(){
    this.router.navigate(['/extract/extractTrain']);
  }

  nextStep(){
    this.router.navigate(['/extract/extractAppAssessment']);
  }
}
